package com.yy.studyspringboot.rabbitmq.demo6springboot整合rabbitmq.producer;

import org.springframework.amqp.core.Binding;
import org.springframework.amqp.core.Exchange;
import org.springframework.amqp.core.Queue;
import org.springframework.amqp.core.TopicExchange;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class RabbitConfig {

    /**
     * 创建队列
     */
    @Bean
    public Queue queue() {
        return new Queue("queue.boot", false, false, false, null);
    }

    /**
     * 创建交换机
     */
    @Bean
    public Exchange exchange() {
        return new TopicExchange("ex.boot", false, false, null);
    }

    /**
     * 绑定
     */
    @Bean
    public Binding binding() {
        return new Binding("queue.boot",Binding.DestinationType.QUEUE,"ex.boot","key.boot",null);
    }
}
